Adding a bit of Win95

back to section start!

  It's a sorry day when we copy a MicroSoft idea, but here we go.

/*
$VER: CutNPaste.dopus5 1.1 (30.10.97)
*/

/* Cut & Paste module - Adds "Cut" and "Copy" */
/* to file pop-up menus and "Paste" to lister */
/* pop-up menus.  Nothing is done until you   */
/* Paste when the appropriate Copy or Move    */
/* command is issued.  Andrew Dunbar Oct 1997 */

parse arg portname function source dest arguments
address value portname
options results

if function = 'init' then do
  cnptypes = 'type drawer type tool type project type trash'
  dopus command 'Clip-Copy' program 'CutNPaste' ext 'Copy' private cnptypes
  dopus command 'Clip-Cut' program 'CutNPaste' ext 'Cut' private cnptypes
  dopus command 'Clip-Paste' program 'CutNPaste' ext 'Paste' private type lister
end
else if function = 'Clip-Cut' then address command 'echo >T:clipcnp cut'arguments
else if function = 'Clip-Copy' then address command 'echo >T:clipcnp copy'arguments
else if function = 'Clip-Paste' then do
  lister query source path
  pastepath = result
  if open('cnpfile','T:clipcnp','r') then do
    cnpinfo = readln('cnpfile')
    call close('cnpfile')
    parse var cnpinfo cmd srcfile
    srcfile = trim(srcfile)
    if srcfile ~= '' then do
      if cmd = 'copy' then command copy 'name='srcfile 'to='pastepath
        else if cmd = 'cut' then command move 'name='srcfile 'to='pastepath
      lister wait source
      lister read source pastepath force
    end
    else dopus request '''Paste: Clipboard invalid'''
  end
  else dopus request '''Paste: Nothing in clipboard'''
end
exit

  After you put this into the DOpus5:Modules/ directory, the popup menus on
files of the type drawer, tool, project and trash will have two menu items
called 'Copy' and 'Cut'.  Lister will inherit a popup menu item called
'Paste'.
  When you select either Cut or Copy from a file's popup menu it's name will
be echoed to a file in T: along with the function, cut or copy.
  When you select Paste from a lister's popup menu, this file will be opened
if it exists, (an error requester is displayed if it doesn't), and it's
contents read.  If the action was to Copy then the file is copied to the
lister, if it was Cut then the file will be moved to the lister.

DOpus PLUS - giving you that bit extra...